// @ts-nocheck
import axios from '../request';
import cloneDeep from 'lodash/cloneDeep';

interface Config {
  id: number;
  logo: string;
  themeColor: string;
  auxiliaryColor: string;
  background: string;
  shmentColor: string;
  fontColor: string;
  fontFamily: string;
  textFamily: string;
  sizeType: number;
  contentSize: string;
  titleSize: string;
  mintitleSize: string;
  styleType: number;
  moduleList: any;
  banners: any;
}
// 保存配置数据
export const saveConfig = (projectId: number | string, data: Config) => {
  let info: Config = cloneDeep(data);
  info.moduleList.forEach((element) => {
    element.remarks = '';
  });
  return axios.post<any>(`api/template/config/${projectId}`, info);
};
// 获取保存配置数据
export const configData = (projectId: number | string) => {
  return axios.get<any>(`api/template/configData/${projectId}`, {});
};
export const exhibitShowpiece = (moduleId: number | string, showpieceid: number | string) => {
  return axios.get<any>(`api/showpiece/exhibition/${moduleId}/${showpieceid}`, {});
};
// 获取项目展品单位
export const companysData = (projectId: number | string) => {
  return axios.get<any>(`api/exhibition/companys/${projectId}`, {});
};
// 获取项目展品单元
export const modulesData = (projectId: number | string) => {
  return axios.get<any>(`api/exhibition/firstModules/${projectId}`, {});
};
interface Exhibition {
  projectId?: number | string;
  companyId?: number;
  moduleId?: number;
  typeId?: number;
  ageId?: number;
  levelId?: number;
  sourceId?: number;
  value?: string;
  pageNo?: number;
  pageSize?: number;
}
// 获取项目展品列表
export const exhibitionData = (projectId: number | string, data: Exhibition) => {
  return axios.get<any>(`api/exhibition/childShowpieces/${projectId}`, data);
};
interface Copyright {
  value: number | string;
  text: string;
}
//保存版权声明
export const copyrightSave = (data: Copyright) => {
  return axios.put<any>(`api/template/copyright`, data);
};
//获取版权声明
export const copyrightInfo = (projectId: number | string) => {
  return axios.get<any>(`api/template/copyright/${projectId}`, {});
};
//项目模板详情
export const projectTemplate = (projectId: number | string) => {
  return axios.get<any>(`api/template/project/${projectId}`, {});
};

//获取辅助信息列表
export const auxiliarysList = (projectId: number | string, moduelId: number | string, parmas: any) => {
  return axios.get<any>(`api/exhibition/auxiliarys/${projectId}/${moduelId}`, parmas);
};
//获取门户模板列表
export const doortemplateList = (data: TemplateInfo) => {
  return axios.get<any>(`api/template/door`, data);
};
//获取门户模板详情
export const templateInfo = (id: number | string, projectId?: number | string) => {
  return axios.get<any>(`api/template/detail/${id}${projectId ? '?pid=' + projectId : ''}`);
};
//获取门户相关模板列表
export const relateTemplateList = (data: TemplateInfos) => {
  return axios.get<any>(`api/template/relatedList/${data.id}?pageSize=${data.pageSize}`, {});
};
//设置模板
export const setTemplate = (projectId: number | string, templateId: number | string) => {
  return axios.put<any>(`api/template/set/${projectId}/${templateId}`, {});
};
//保存策展团队说明
export const teamContentSave = (data: any) => {
  return axios.put<any>(`api/exhibition/teamContent`, data);
};
//获取策展团队声明
export const teamContentInfo = (projectId: number | string) => {
  return axios.get<any>(`api/exhibition/teamContent/${projectId}`, {});
};
